﻿using System;
using Oxage.Common;

namespace Oxage.Midi
{
	public interface IConnector
	{
		/// <summary>
		/// When implements gets a value indicating whether a connector is opened.
		/// </summary>
		bool IsOpened { get; }

		/// <summary>
		/// When implements gets a value indicating whether a connector can work as input (can accept incoming data), output (can send data forward), or both.
		/// </summary>
		DataDirection Direction { get; }

		/// <summary>
		/// When implemented opens a connector. Before the connector is opened it should not send nor receive any data.
		/// </summary>
		void Open();

		/// <summary>
		/// When implemented closes a connector. After the connector is closed it should not send nor receive any data.
		/// </summary>
		void Close();

		/// <summary>
		/// When implemented sends a standard MIDI message (i.e. note on, note off, etc.).
		/// </summary>
		/// <param name="message"></param>
		void Send(IMessage message);

		/// <summary>
		/// When implemented occurs when a MIDI message is received.
		/// </summary>
		event EventHandler<EventArgs<IMessage>> Received;

		/// <summary>
		/// Gets a configuration panel for the connector.
		/// </summary>
		/// <returns></returns>
		IConfigPanel GetConfigPanel();
	}
}
